package com.moons.demo.aicamera.facerecognition.util.ThreadPool;

import android.os.Process;

import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;

import androidx.annotation.NonNull;

/**
 * Created by WilsonZhang on 2018/6/14.
 */

public class BackgroundThreadFactory implements ThreadFactory {
    private final AtomicInteger integer = new AtomicInteger();
    @Override
    public Thread newThread(@NonNull Runnable r) {
        Thread t=new Thread(r,"BackgroundThreadFactory thread:"+integer.getAndIncrement());
        t.setPriority(Process.THREAD_PRIORITY_BACKGROUND);

        return t;
    }
}
